Linking Different Sections of a Web Page

You can link to different locations of a Web page either in the same document or in different documents. Links to a specific location within the same document tare created for Web pages containing a large amount of text. To do this you need to create a hyperlink using the anchor tag (<a>). After creating a hyperlink, you can specify the location where you want to link on the Web page by using the href attribute. The reference of the anchor tag inside the href attribute starts with the # symbol.

Let’s do the following steps to link different sections of a Web page:


<!DOCTYPE html>
<head>
    <title>Links </title>
</head>
<body>
    <center>
    <h1>Linking to a section in a page</h1>
    <h4> Click here to go at the 
    <a href=”#BOTTOM”> bottom </a> 
of the page.</h4>    
<br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/>
<hr>
<a name=”BOTTOM”><h4> This is the bottom of the page.</h4></a>
</center>
</body>
</html>

Save the document with the name LinkingSections.html and open on browser.

Note: In place of the name attribute of the <a> tag, you can also use the id attribute.

Let’s now learn about adding images in a Web page.